﻿@page "/AxesX"

<Card>
    <ChildContent>
        <div class="card">
            <div class="chart">
                <BcChart @ref="@bcChart" Height="400" Width="600" Data="DemoData.Githubs" CategoryField="x=>x.Year.ToString()">
                    <BcTitle Title="X轴基本使用" TData="Github"></BcTitle>
                    <BcAxesX TData="Github"  GridLineMajor="@gridLineMajor" DistanceAxis="@distanceAxis" LabelPosition="@labelPosition"  
                             Visible="@visible"></BcAxesX>
                    <BcColumnSeries TData="Github" ValueFunc="x=>x.Sum(y=>y.View)" GroupName="View" ></BcColumnSeries>
                    <BcColumnSeries TData="Github" ValueFunc="x=>x.Sum(y=>y.Start)" GroupName="Start"></BcColumnSeries>
                    <BcLineSeries TData="Github" ValueFunc="x=>x.Sum(y=>y.Fork)" GroupName="Fork" ></BcLineSeries>
                    
                </BcChart>
            </div>
            <div class="prop">
                <Divider Text="与坐标轴的距离" Orientation="left"></Divider>
                <InputNumber @bind-Value="@distanceAxis"></InputNumber>

                <Divider Text="标签位置" Orientation="left"></Divider>
                <RadioGroup @bind-Value="@labelPosition">
                    <Radio Value="AxesLabelPosition.Axis">轴旁</Radio>
                    <Radio Value="AxesLabelPosition.None">无</Radio>
                </RadioGroup>

                <Divider Text="网格线" Orientation="left"></Divider>
                <Checkbox @bind-Value="@gridLineMajor">主要</Checkbox>

                <Divider Text="属性" Orientation="left"></Divider>
                <Checkbox @bind-Value="@visible">显示/隐藏</Checkbox>

                <Divider></Divider>
                <Button Type="primary" OnClick="OnClick">应用</Button>
            </div>
        </div>
    </ChildContent>
</Card>

<ApiTable Component="typeof(BcAxesX<object>)"></ApiTable>

@code{

    bool gridLineMajor = false;

    int? distanceAxis;

    bool visible = true;

    AxesLabelPosition labelPosition=AxesLabelPosition.Axis;

    BcChart<Github> bcChart;

    public void OnClick()
    {
        bcChart.Refresh();
    }

}
